package easy.Excel表列名称;


import easy.相交链表.ListNode;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Solution {
    public String convertToTitle(int columnNumber) {
        StringBuilder sb = new StringBuilder();
        while (columnNumber > 0) {
            columnNumber--;
            sb.append((char) (columnNumber % 26 + 'A'));
            columnNumber /= 26;
        }
        sb.reverse();
        return sb.toString();
    }

    public static void main(String[] args) {
        int columnNumber = 1;
        int columnNumber2 = 28;
        int columnNumber3 = 701;
        int columnNumber4 = 2147483647;
        Solution solution = new Solution();
        System.out.println(solution.convertToTitle(columnNumber));
        System.out.println(solution.convertToTitle(columnNumber2));
        System.out.println(solution.convertToTitle(columnNumber3));
        System.out.println(solution.convertToTitle(columnNumber4));
    }
}
